If an error condition occurs, this routine returns an integer
value indicating the type of error. Possible return values are as
follows:
Return Description
0 Successful completion, the lock is acquired for write
access.
[EBUSY] The lock was not acquired for write access, as it is
already held by another thread.
[EINVAL] The value specified by lock is not a valid read-write
lock.